package com.ruoyi.service.jpjs.empcertificate.impl;

import com.ruoyi.mapper.jpjs.empcertificate.EmpCertificateMapper;
import com.ruoyi.mapper.jpjs.empchange.EmpChangeMapper;
import com.ruoyi.service.jpjs.PublicService;
import com.ruoyi.service.jpjs.empcertificate.EmpCertificateService;
import com.ruoyi.service.jpjs.empchange.EmpChangeService;
import com.ruoyi.util.BaseResult;
import com.ruoyi.util.ResultEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class EmpCertificateServiceimpl implements EmpCertificateService {

    @Autowired
    EmpCertificateMapper empCertificateMapper;

    @Autowired
    PublicService publicService;

    @Override
    public List<Map<String, Object>> list(Map map) {
        List<Map<String, Object>> compList = publicService.findUserCompAndJszb();
        map.put("compList", compList);
        return empCertificateMapper.list(map);
    }

    @Override
    public int add(Map map) {
        return empCertificateMapper.add(map);
    }

    @Override
    public Map<String, Object> findDataById(String id) {
        return empCertificateMapper.findDataById(id);
    }

    @Override
    public int edit(Map map) {
        return empCertificateMapper.edit(map);
    }

    @Override
    public int remove(String ids) {
        String[] idSplit = ids.split(",");
        int num = 0;
        for (String id : idSplit) {
            num += empCertificateMapper.remove(id);
        }
        return num;
    }
}
